#ifndef _CEMITTER_H_
#define _CEMITTER_H_

#include <vector>



class CParticle;
class CBase;

class CEmitter
{
private:

	std::vector<CParticle*> liveparticles;
	std::vector<CParticle*> deadparticles;

	float Life;
    int Count;
    int Width;
    int Height;
    int PosX;
    
    int PosY;
    int ImageID;
    float VelX;
    float VelY;
    int angle;


    float BeginA;
    float BeginR;
    float BeginG;
    float BeginB;

    float DA;
    float DR;
    float DG;
    float DB;

    float Beginscale;
    float DS;

    bool Looping;

	float totalspawntime;

	float YAcel;
	float XAcel;

	CParticle* parts;

	int sourceblend;
	int destblend;

	CBase* object;
	int objX;
	int objY;
	bool isplaying;
	float permavelX;
	float permavelY;
	

	unsigned long initialsource;
	unsigned long initialdest;

	void ResetParticle(int index);
	float DegreeToRadian(float angle);
public:

	CEmitter(int nNumParticles, int nEmitterHeight, int nEmitterWidth, 
		float fParticleLife, float fStartParticleScale, int PosX, int PosY, int ImageID, float VelX, float Vely, int angle, float BeginA, 
		float BeginR, float BeginG, float BeginB, float DA, float DR, float DG, float DB, float DS, bool Looping, int source, int dest, float aX, float aY);

	CEmitter(CEmitter& copied);

	~CEmitter(void);

	void update(float elapsedtime);

	void render();

	void SetObject(CBase* object, int offsetx = 0, int offsety = 0);


	void setposX(int X){PosX = X;}
	void setposY(int Y){PosY = Y;}

	bool isitplaying(){return isplaying;}
	void setplaying(bool play){isplaying = play;}

};

#endif